﻿using FSM.Model;
using System;
using System.Collections.Generic;
using System.Text;

namespace FSM.IBll
{
    public interface ISysUserBll
    {
        #region 查询

        /// <summary>
        /// 获得单个用户信息
        /// </summary>
        /// <param name="user_no">用户编号</param>
        /// <returns></returns>
        sys_user Get(string user_no);

        /// <summary>
        /// 列出用户信息
        /// </summary>
        /// <param name="user_no">用户账号</param>
        /// <param name="user_name">用户名称</param>
        /// <param name="page">页码</param>
        /// <param name="page_size">每页显示的条数</param>
        /// <returns>
        /// 用户记录和总记录数
        /// </returns>
        Tuple<List<sys_user>, int> List(string user_no, string user_name, int page, int page_size);

        #endregion

        #region 提交

        /// <summary>
        /// 插入
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        bool Insert(sys_user model);

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        bool Update(sys_user model);

        /// <summary>
        /// 更新密码
        /// </summary>
        /// <param name="user_no">用户编号</param>
        /// <param name="old_password">旧密码</param>
        /// <param name="new_password">新密码</param>
        /// <returns></returns>
        bool UpdatePassword(string user_no, string old_password, string new_password);

        /// <summary>
        /// 更新用户头像
        /// </summary>
        /// <param name="oper">操作人员</param>
        /// <param name="user_no">用户编号</param>
        /// <param name="avatar">头像文件</param>
        /// <returns></returns>
        bool UpdateAvatar(string oper, string user_no, string avatar);

        /// <summary>
        /// 还原密码
        /// </summary>
        /// <param name="user_no">用户编号</param>
        /// <param name="oper">操作人员</param>
        /// <returns></returns>
        bool ResetPassword(string oper, string user_no);

        /// <summary>
        /// 更新用户编号删除指定用户
        /// </summary>
        /// <param name="user_no">用户编号</param>
        /// <returns></returns>
        bool Delete(string oper, string user_no);

        #endregion

        #region 扩展方法

        /// <summary>
        /// 登录验证
        /// </summary>
        /// <param name="user_no">用户编号</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        bool ValidLogin(string user_no, string password);

        #endregion
    }
}
